home *** CD-ROM | disk | FTP | other *** search
- /*
- * Polygon.h - class definition for polygon handling.
- *
- * Copyright (C) 1992, Christoph Streit (streit@iam.unibe.ch)
- * University of Berne, Switzerland
- * All rights reserved.
- *
- * This software may be freely copied, modified, and redistributed
- * provided that this copyright notice is preserved on all copies.
- *
- * You may not distribute this software, in whole or in part, as part of
- * any commercial product without the express consent of the authors.
- *
- * There is no warranty or other guarantee of fitness of this software
- * for any purpose. It is provided solely "as is".
- *
- */
-
- #ifndef Polygon_H
- # define Polygon_H
-
- #include "Vector.h"
- #include "TransMatrix.h"
- #include "list.h"
-
- declareList(VertexList, Vector);
-
- class Polygon
- {
- public:
- Polygon(long size = 100);
- Polygon(const Vector&, const Vector&, const Vector&);
- Polygon(const Vector&, const Vector&, const Vector&, const Vector&);
- Polygon(const Polygon&);
- ~Polygon();
-
- void transform(const TransMatrix&);
- const Vector& normal() const;
- void addVertex(const Vector&);
- void removeVertex(long);
- long numVertices() const;
- const Vector& vertex(long) const;
-
- private:
- VertexList* vertices;
- };
-
- typedef Polygon* PolygonPtr;
- declareList(PolygonList, PolygonPtr);
-
- inline long Polygon::numVertices() const {
- return vertices->count();
- }
-
- inline const Vector& Polygon::vertex(long index) const {
- return vertices->item(index);
- }
-
- #endif // Polygon_H
-